<style lang="scss">
	@import "../../utils/base.scss";
    .myLabel:before{
        content: '*';
        display: inline-block;
        margin-right: 4px;
        line-height: 1;
        font-family: SimSun;
        font-size: 14px;
        color: #ed4014;
    }
    .myInput{
        border:1px solid #ed4014
    }
    .myForm{
      position: relative;
      line-height: 32px;
      font-size: 14px;
    }
	#numberfile {
	  display: none;
	}
</style>
<template>
	<div style="height:100%;">
		<div style="width: 100%;background-color: white;overflow-y: auto;overflow-x: hidden;padding:1%;height: 100%;">
			<Form id="baseInfo" ref="object" :model="object" label-position="left" :label-width="110" :rules="ruleAccount" style="position:relative;left:4%">
				<Row v-if="reqId != null && reqId != ''">
					<Col span="8">
					<FormItem label="工单ID：">
						<Input v-model="reqId" style="width:75%" :readonly="true" />
					</FormItem>
					</Col>
				</Row>
				<Row>
					<Col span="8">
					<FormItem label="工单标题：" prop="reqSubject">
						<Input v-model="object.reqSubject" style="width:75%" :readonly="ifedit" placeholder="XX租户XX申请XX系统XX账号" />
					</FormItem>
					</Col>
					<Col span="8">
					<FormItem label="所属系统：" :required="true">
						<Input v-if="ifedit" v-model="sysModel.sysName" style="width:75%" :readonly="true" />
						<Select v-else v-model="object.sysId" :label-in-value="true" :transfer="true" filterable style="width:75%"
						 @on-change="selectSys">
							<Option v-for="item in sysList" :value="item.id" :key="item.id">{{ item.sysName }}</Option>
						</Select>
					</FormItem>
					</Col>
				</Row>
				<Row>
					<Col span="8">
					<FormItem label="所属租户： " :required=" true">
						<Input v-if="ifedit" v-model="oriRole.role_name" style="width:75%" :readonly="true" />
						<Select v-else v-model="object.roleId" :label-in-value="true" @on-change="getProject" :transfer="true" filterable
						 style="width:75%">
							<Option v-for="item in roleList" :value="item.id" :key="item.id">{{ item.tenant_name}}</Option>
						</Select>
					</FormItem>
					</Col>
					<Col span="8">
					<FormItem label="所属项目： " :required=" true">
						<Input v-if="ifedit" v-model="project.project" style="width:75%" :readonly="true" />
						<Select v-else v-model="object.projectId" :label-in-value="true" :transfer="true" filterable style="width:75%"
						 @on-change="selectProject">
							<Option v-for="item in projectList" :value="item.id" :key="item.id">{{ item.project }}</Option>
						</Select>
					</FormItem>
					</Col>
				</Row>
				<Row>
					<Col>
					<FormItem label="申请原因：" prop="reqDes">
						<Input v-model="object.reqDes" type="textarea" maxlength="250" show-word-limit :rows="3" style="width:93%"
						 :readonly="ifedit" />
					</FormItem>
					</Col>
				</Row>
			</Form>
			<template v-if="!ifedit">
				<Button type="primary" @click="selectNumber" style="margin-left: 4%;margin-bottom: 12px;">批量导入账号</Button>
				<input type="file"  multiple="multiple"  id="numberfile" @change="importNumber" />
				<a href="./static/file_mould/account.xlsx" class="download_boder" style="font-size: 13px;margin-left: 10px; position: relative;">账号模板</a>
			</template>

			<accountUtils v-model="people" :ifedit="ifedit" :peopleList="peopleList" :dutyList="dutyList"></accountUtils>

			<!-- 附件 -->
			<template>
				<Divider orientation="left">附件</Divider>
				<component ref="file" :is="'file'" :ifedit="ifedit" :filesList="filesList" v-model="files"></component>
			</template>
		</div>
	</div>
</template>
<script>
	import ajax from "../../ajax_util"
	import Axios from 'axios'
	import notice from '../../base/notice'
	import inputSearch from '../../base/input_search'
	import file from './settledin/file'
	import PDFJs from '../../plugins/PDFJs.js'
	import printModel from './print/print_model'
	import accountUtils from './other_utils/account_utils_old.vue'
	import excel from "../../utils/excel";

	export default {
		name: "apply",
		components: {
			notice,
			inputSearch,
			file,
			printModel,
			accountUtils
		},
		data() {
			return {
				ruleAccount: {
					reqDes: [{
						required: true,
						message: '请输入申请原因',
						trigger: 'blur'
					}],
					reqSubject: [{
							required: true,
							message: '请输入工单主题',
							trigger: 'blur'
						},
						{
							type: 'string',
							max: 50,
							message: '最多填写50个字符',
							trigger: 'blur'
						}
					]
				},
				options: {
					disabledDate(date) {
						var now = Date.now();
						var temp = new Date(now);
						var nextYear = temp.getFullYear() + 1;
						var month = temp.getMonth() + 1;
						var day = temp.getDate();
						var t = nextYear + "-" + month + "-" + day;
						var endTime = new Date(t).valueOf()
						return date && (date.valueOf() < Date.now() - 86400000 || date.valueOf() > endTime);
					}
				},
				fileUrl: this.CONFIG.file_url,
				showFileMould: false,
				showmd: true,
				//serviceType:"",
				httpHeader: {
					Authorization: this.$store.state.token
				},
				// ifedit: this.isedit,
				sysList: [],
				comDepList: [],
				itContactList: [],
				peopleList: [],
				companyList: [],
				departmentList: [],
				dutyList: [{
						value: "平台开发(pdev)",
						label: "平台开发(pdev)"
					},
					{
						value: "平台维护(pops)",
						label: "平台维护(pops)"
					},
					{
						value: "业务开发(bdev)",
						label: "业务开发(bdev)"
					},
					{
						value: "业务维护(bops)",
						label: "业务维护(bops)"
					}
				],
				attrList: [{
						value: "个人实名制帐号",
						label: "个人实名制帐号"
					},
					{
						value: "程序内置帐号",
						label: "程序内置帐号"
					},
					{
						value: "超级用户帐号",
						label: "超级用户帐号"
					},
					{
						value: "FTP账号",
						label: "FTP账号"
					},
					// {
					//   value: "HFTP账号",
					//   label: "HFTP账号"
					// },
					{
						value: "前台账号",
						label: "前台账号"
					}
				],
				paasList: [{
						value: "paas_huawei",
						label: "华为PaaS"
					},
					{
						value: "paas_asia",
						label: "亚信PaaS"
					}
				],
				dacpList: [{
						value: "平台管理",
						label: "平台管理"
					},
					{
						value: "开发管理",
						label: "开发管理"
					},
					{
						value: "数据开发",
						label: "数据开发"
					}
				],
				people: [],
				object: {
					reqSubject: "",
					files: [{
						fileName: "",
						fileUrl: ""
					}],
					id: 0,
					isFromEntry: 0,
					sysId: 0,
					people: [],
					projectId: "",
					purpose: "",
					reqDes: "",
					reqId: 0,
					roleId: "",
					status: 0,
					userId: "",
					itBranchId: 0,
					itContactId: 0,
					itBranch: "",
					itName: "",
					sysName: "",
					tenantName: "",
					projectName: "",
					businessId: 0
				},
				files: [],
				roleList: [],
				projectList: [],
				content: {},

				oriRole: {
					id: 0,
					role_name: ""
				},
				project: {
					id: 0,
					project: ""
				},
				itBranch: {
					id: 0,
					gName: ""
				},
				itUser: {
					id: 0,
					user_name: ""
				},
				sysModel: {
					id: 0,
					sysName: ""
				},
				userId: 0,
				isIT: -1,
				hadoopList: [{
						value: "HDFS",
						label: "HDFS"
					},
					{
						value: "Hive",
						label: "Hive"
					},
					{
						value: "HBase",
						label: "HBase"
					},
					{
						value: "Kafka",
						label: "Kafka"
					},
					{
						value: "Flume",
						label: "Flume"
					},
					{
						value: "UDF",
						label: "UDF"
					},
					{
						value: "HFTP",
						label: "HFTP"
					},
					{
						value: "其他",
						label: "其他"
					}
				],
				printObject: [],
				printLength: 0
			}
		},
		created: function() {},
		mounted: function() {
			this.$nextTick(() => {
				if (this.reqId == null && this.draftsId == null) {
					this.getRoles(this.$store.state.user.id);
					this.getSys();
					// this.getNextYear(0);
				} else if (this.reqId != null) {
					//console.log("获取表单详情---------->");
					this.getApplyInfo(); //获取表单详情
				} else if (this.draftsId != null) {
					//console.log("获取草稿---------->")
					this.getDrafts();
					this.getSys();
				}
			})
		},
		methods: {
			selectNumber() {
				const el = document.getElementById("numberfile");
				el.click();
			},
			async importNumber() {
				const el = document.getElementById("numberfile");
				const file = el.files[0];
				var that = this
				var data = await excel.importSheets(file, -1, -1,"", 0);
				if(data.length > 0){
					this.handlefile(data)
					that.$Notice.success({
						title: '导入成功',
					});
				}else {
					that.$Notice.error({
						title: '导入失败',
					});
				}

				console.log("projectList-------->", data)
				el.value = "";
			},
			handlefile(data){
				var userList = data.find(e => e.sheetName == '用户信息').body
				if(userList.length > 0){
					userList.forEach((item, index)  =>{
						var temp = {
							isExpand: 0,
							date: "",
							isSever: false,
							isDb: false,
							isHadoop: false,
							isHftp: false,
							isPaas: false,
							isDacp: false,
							isElse: false,
							companyList: [],

							baseId: 0,
							commons: [{
								accountType: 0,
								deadline: 0,
								des: "",
								id: 0,
								json: "",
								peopleId: 0,
								status: 0,
								subAccount: ""
							}],
							dacps: [
							],
							dbs: [
							],
							deadline: 0,
							duty: "",
							elseAuthes: [
							],
							exAccount: "",
							fourA: "",
							hadoops: [
							],
							hftps: [
							],
							id: 0,
							igroup: "",
							outterCompany: "",
							outterCompanyId: 0,
							paas: [
							],
							peopleName: "",
							peopleType: 0,
							peopleUserId: 0,
							phone: "",
							severs: [
							],
							tenantName: ""
						}
						
						if(index != 0 ){
							var t = JSON.stringify(this.people[this.people.length - 1])
							temp = JSON.parse(t)
						}
						temp.peopleName = item['姓名'];
						temp.peopleUserId = item['姓名'];
						this.peopleList.push({
							id: temp.peopleName,
							user_name: temp.peopleName,
						})
						temp.fourA = item['已有4A账号'];
						temp.phone = item['联系方式'];
						temp.duty = item['工作职责'];
						if(!this.utils.objectIsEmpty(temp.duty) && this.dutyList.find(e => e.value == temp.duty) == undefined){
							this.dutyList.push({
								value: temp.duty,
								label: temp.duty,
							})
						}
						temp.outterCompany = item['组织名称'];
						temp.date = item['帐号使用期限']
						temp.deadline = new Date(temp.date).getTime()/1000
						temp.exAccount = item['已有账号名']
						
						if(index == 0 ){
							console.log("主机账号-------->")
							// 主机账号
							var severList = data.find(e => e.sheetName == '主机账号').body
							if(severList.length > 0){
								temp.isSever = true
								
								severList.forEach( sever =>{
									temp.severs.push({
										accountAttr: sever['账号属性'],
										deadline: 0,
										id: 0,
										ip: sever['设备IP地址'],
										peopleId: 0,
										rxPath: sever['组读和执行权限目录'],
										sname: sever['设备名称'],
										status: 0,
										subAccount: "",
										wpath: sever['该用户组需写权限目录'],
									})
								})
							}
							// 数据库账号
							var DBList = data.find(e => e.sheetName == '数据库账号').body
							if(DBList.length > 0){
								temp.isDb = true
								DBList.forEach( db =>{
									temp.dbs.push({
										accountAttr: db['账号属性'],
										auth: db['权限'],
										dbName: db['库名'],
										deadline: 0,
										id: 0,
										ip: db['设备IP地址'],
										peopleId: 0,
										sname: db['设备名称'],
										status: 0,
										subAccount: "",
										tableName: db['表名'],
									})
								})
							}
							
							// Hadoop账号
							var hadoopList = data.find(e => e.sheetName == 'Hadoop账号').body
							if(hadoopList.length > 0){
								temp.isHadoop = true
								hadoopList.forEach( hadoop =>{
									temp.hadoops.push({
										hadoopAccountType: hadoop['Hadoop组件'],
										auth: hadoop['具体权限描述'],
										cpu: 10,
										deadline: 0,
										hdfs: "100G",
										keytab: hadoop['keytab描述'],
										id: 0,
										mem: 40,
										peopleId: 0,
										status: 0,
										subAccount: ""
									})
								})
							}
							
							// UAP账号
							var hftpList = data.find(e => e.sheetName == 'UAP账号').body
							if(hftpList.length > 0 && (hftpList[0]['采集交换集群与租户集群数据流转'] == '是' 
								|| hftpList[0]['采集交换集群与租户个人FTP数据流转'] == '是' || hftpList[0]['采集交换集群与生产集群（如Hadoop三期二生产集群）数据流转'] == '是')){
								temp.isHftp = true
								hftpList.forEach( hftp =>{
									temp.hftps.push({
										deadline: 0,
										id: 0,
										isCluster: hftp['采集交换集群与租户集群数据流转'] == '是' ? true : false,
										isPerson: hftp['采集交换集群与租户个人FTP数据流转'] == '是' ? true : false,
										isPro: hftp['采集交换集群与生产集群（如Hadoop三期二生产集群）数据流转'] == '是' ? true : false,
										peopleId: 0,
										status: 0,
										subAccount: ""
									})
								})
							}
							
							// PaaS门户账号
							var paasList = data.find(e => e.sheetName == 'PaaS门户账号').body
							if(paasList.length > 0){
								temp.isPaas = true
								paasList.forEach( paas =>{
									temp.paas.push({
										deadline: 0,
										id: 0,
										paasType: paas['账号类型'] == '华为PaaS'?'paas_huawei':paas['账号类型'] == '亚信PaaS'? 'paas_asia':'',
										peopleId: 0,
										status: 0,
										subAccount: ""
									})
								})
							}
							
							// DACP账号
							var adcpList = data.find(e => e.sheetName == 'DACP账号').body
							if(adcpList.length > 0){
								temp.isDacp = true
								adcpList.forEach( dacp =>{
									temp.dacps.push({
										dacpAccoutType: dacp['账号类型'],
										deadline: 0,
										id: 0,
										peopleId: 0,
										status: 0,
										subAccount: ""
									})
								})
							}
							// 其他权限内容
							var elseList = data.find(e => e.sheetName == '其他权限内容').body
							if(elseList.length > 0 ){
								temp.isElse = true
								elseList.forEach( t =>{
									temp.elseAuthes.push({
										deadline: '',
										des:'',
										id: 0,
										peopleId: 0,
										status: 0,
										subAccount: ""
									})
								})
							}
						}
						
						this.people.push(temp)
						console.log("temp---->",this.people,temp,userList)
						this.$forceUpdate()
					})
				}
			},
			// 导出
			exportAccount() {
				console.log("!!!!!!!!!!!");
				//列标题，逗号隔开
				let str = `姓名,主账号,已有账号名,所属系统,账号类型,账号属性,ip信息\n`;
				//增加\t为了不让表格显示科学计数法或者其他格式
				for (let i = 0; i < this.people.length; i++) {
					for (let j = 0; j < this.people[i].severs.length; j++) {
						//str+=`${jsonData[i][item] + '\t'},`;
						str += this.people[i].peopleName + "," + this.people[i].fourA + "," + this.people[i].exAccount + "," + this.sysModel.sysName + ","
						 + "主机账号" + "," + this.people[i].severs[j].accountAttr + "," + this.people[i].severs[j].ip + '\n';
					}

					for (let j = 0; j < this.people[i].dbs.length; j++) {
						//str+=`${jsonData[i][item] + '\t'},`;
						str += this.people[i].peopleName + "," + this.people[i].fourA + "," + this.people[i].exAccount + "," + this.sysModel.sysName + "," 
						+ "数据库账号" + "," + this.people[i].dbs[j].accountAttr + "," + this.people[i].dbs[j].ip + '\n';
					}

					for (let j = 0; j < this.people[i].hadoops.length; j++) {
						//str+=`${jsonData[i][item] + '\t'},`;
						str += this.people[i].peopleName + "," + this.people[i].fourA + "," + this.people[i].exAccount + "," + this.sysModel.sysName + "," 
						+ "Hadoop账号" + "," + "" + "," + "" + '\n';
					}

					for (let j = 0; j < this.people[i].hftps.length; j++) {
						//str+=`${jsonData[i][item] + '\t'},`;
						str += this.people[i].peopleName + "," + this.people[i].fourA + "," + this.people[i].exAccount + "," + this.sysModel.sysName + "," 
						+ "UAP账号" + "," + "" + "," + "" + '\n';
					}

					for (let j = 0; j < this.people[i].paas.length; j++) {
						//str+=`${jsonData[i][item] + '\t'},`;
						str += this.people[i].peopleName + "," + this.people[i].fourA + "," + this.people[i].exAccount + "," + this.sysModel.sysName + "," 
						+ "PaaS账号" + "," + "" + "," + "" + '\n';
					}

					for (let j = 0; j < this.people[i].dacps.length; j++) {
						//str+=`${jsonData[i][item] + '\t'},`;
						str += this.people[i].peopleName + "," + this.people[i].fourA + "," + this.people[i].exAccount + "," + this.sysModel.sysName + "," 
						+ "DACP账号" + "," + "" + "," + "" + '\n';
					}

					for (let j = 0; j < this.people[i].elseAuthes.length; j++) {
						//str+=`${jsonData[i][item] + '\t'},`;
						str += this.people[i].peopleName + "," + this.people[i].fourA + "," + this.people[i].exAccount + "," + this.sysModel.sysName + "," 
						+ "其他账号" + "," + "" + "," + "" + '\n';
					}
				}

				//encodeURIComponent解决中文乱码， \ufeff是 ""
				let uri = 'data:text/csv;charset=utf-8,\ufeff' + encodeURIComponent(str);
				//通过创建a标签实现
				let link = document.createElement("a");
				link.href = uri;
				//对下载的文件命名
				link.download = "工单" + this.reqId + "_账号信息.csv";
				document.body.appendChild(link);
				link.click();
				document.body.removeChild(link);
			},
			exportSevers(){
				var option = {
					title: [],
					body: [],
					name: 'batchCreateHostAcct',
					suffix: 'xls',
					sheetName:'',
					merges: [
						{
							s: { r: 3, c: 9 },
							e: { r: 8, c: 9 }
						},
						{
							s: { r: 1, c: 10 },
							e: { r: 8, c: 10 }
						},
						{
							s: { r: 1, c: 11 },
							e: { r: 8, c: 11 }
						}
					]
				}

				var str01 = "是否允许删除" + "\r\n" + "0:不可以" + "\r\n" + "1:可以";
				var str02 = "批量创建程序帐号时，可全部或部分指定密码，密码需满足密码策略要求，其它类型帐号创建时，设置无效";
				var str03 = "修改主机帐号密码是否推送密码文件到FTP服务器上" + "\r\n" + "不填：不推送" + "\r\n" + "0：不推送" + "\r\n" + "1：推送";
				var str04 = "加红字体为必填字段";

				option.body.push([]);
				option.body.push(["","","","","","","","","","",str02,str03]);
				option.body.push([]);
				option.body.push(["","","","","","","","","",str01]);
				option.body.push([]);
				option.body.push([]);
				option.body.push([]);
				option.body.push([]);
				option.body.push([str04]);

				var title = ["主机ip","主机帐号","登录HOME","帐号描述","绑定人主帐号","主组","附加组","生效时间","失效时间","可删除","指定密码","是否推送密码文件"]
				option.body.push(title);

				this.people.forEach(item=>{
					if(item.severs != undefined && item.severs != null && item.severs.length>0){
						item.severs.forEach(value=>{
							var severs = [];
							severs.push(value.ip);
							severs.push(item.exAccount);
							if(item.exAccount != undefined && item.exAccount != null && item.exAccount != ""){
								severs.push("/home/" + item.exAccount);
							}else{
								severs.push("");
							}
							severs.push("");
							severs.push(item.fourA);
							severs.push("");
							severs.push("");

							var time = new Date(this.processInfo.startTime*1000);
							var startTime = this.utils.formatDate(time, "yyyy-MM-dd hh:mm:ss");
							severs.push(startTime);

							time.setYear(time.getFullYear() + 2);
							var endTime = this.utils.formatDate(time, "yyyy-MM-dd hh:mm:ss");
							severs.push(endTime);
							console.log("===========",startTime,endTime);

							if(value.accountAttr === "个人实名制帐号"){
								severs.push(1);
							}else{
								severs.push(0);
							}

							severs.push("");
							severs.push("");

							option.body.push(severs);
						})
					}
				})

				if(option.body.length == 1){
					this.$Message.error("暂无主机账号信息可导出!")
				}else{
					excel.exportFromArray(option);
				}
			},
			printBase() {
				this.printObject = [];

				var a = {};
				a.title = "工单标题：";
				a.value = this.object.reqSubject;
				a.type = 0;
				this.printObject.push(a);

				var b = {};
				b.title = "所属系统：";
				b.value = this.object.sysName;
				b.type = 0;
				this.printObject.push(b);

				var c = {};
				c.title = "所属租户：";
				c.value = this.object.tenantName;
				c.type = 0;
				this.printObject.push(c);

				var d = {};
				d.title = "所属项目：";
				d.value = this.object.projectName;
				d.type = 0;
				this.printObject.push(d);

				var e = {};
				e.title = "申请原因：";
				e.value = this.object.reqDes;
				e.type = 1;
				this.printObject.push(e);
				console.log("======printBase========", this.printObject);

				var len = this.printObject.length;
				this.printLength = Math.ceil((len / 3));
			},
			getPrintObject() {
				this.printObject = [];
				//console.log("=========测试获取label===========");
				var element = document.getElementById("baseInfo");
				console.log("=========测试获取label===========");
				var label = element.getElementsByTagName("label");
				console.log(label);
				for (var i = 0; i < label.length; i++) {
					if (label[i].parentElement.getElementsByTagName("input").length > 0) {
						var temp = label[i].parentElement.getElementsByTagName("input")[0];

						var j = {};
						j.title = label[i].innerText;
						j.value = temp.value;
						j.type = 0;

						this.printObject.push(j);
					} else if (label[i].parentElement.getElementsByTagName("textarea").length > 0) {
						var temp = label[i].parentElement.getElementsByTagName("textarea")[0];

						var j = {};
						j.title = label[i].innerText;
						j.value = temp.value;
						j.type = 1;

						this.printObject.push(j);
					} else if (label[i].parentElement.getElementsByTagName("span").length > 0) {
						var j = {};
						j.title = label[i].innerText;
						j.value = temp.value;
						j.type = 0;

						this.printObject.push(j);
					}
				}

				var len = this.printObject.length;
				this.printLength = Math.ceil((len / 3));
				console.log("=====obj======", this.printObject);
				console.log("=====len======", this.printLength);
			},
			print() {
				var printInfo = []
				printInfo.push({
					title: "基本信息",
					type: "dafault",
					info: {
						printObject: this.printObject,
						printLength: this.printLength
					}
				})
				var temp = JSON.stringify(this.people)
				var t = JSON.parse(temp)
				t.forEach(item =>{
					item.date = this.utils.formatDate(new Date(item.date), 'yyyy-MM-dd')
				})
				printInfo.push({
					title: "申请账户信息",
					type: "account",
					info: t
				})

				const {
					href
				} = this.$router.resolve({
					path: '/other_page/print',
					query: {
						serviceType: this.serviceType,
						printName: "非大数据平台部账号申请"
					}
				})
				sessionStorage.printInfo = JSON.stringify(printInfo)
				window.open(href, '_blank')
				this.newValue = false
			},
			ifshowmd(list, tabsPage) {
				var result = false
				for (let index = 0; index < list.length - 1; index++) {
					if (list.tabKey == tabsPage) {
						result = true
					}
				}
				return result
			},
			selectSys(data) {
				console.log("========sys======", data);
				this.object.sysName = data.label;
			},
			selectProject(data) {
				console.log("========selectProject======", data);
				if (data != null && data != undefined) {
					this.object.projectName = data.label;
					this.getBusiness(data.value);
				}
			},
			getApplyInfo() {
				console.log("getApplyInfo------this.processInfo--->", this.processInfo);
				this.itContactList = [];
				var data = this.processInfo;
				var content = data.content;
				if (content.rspInfo != undefined && content.rspInfo != null) {
					if (content.rspInfo.oriRole != undefined && content.rspInfo.oriRole != null) {
						this.oriRole.id = content.rspInfo.oriRole.id
						this.oriRole.role_name = content.rspInfo.oriRole.tenant_name;
						content.tenantName = content.rspInfo.oriRole.tenant_name;
					}

					if (content.rspInfo.project != undefined && content.rspInfo.project != null) {
						this.project = content.rspInfo.project;
						content.projectName = content.rspInfo.project.project;
					}

					if (content.rspInfo.itBranch != undefined && content.rspInfo.itBranch != null) {
						this.itBranch = content.rspInfo.itBranch;
					}

					if (content.rspInfo.itUser != undefined && content.rspInfo.itUser != null) {
						this.itUser = content.rspInfo.itUser;
						this.itContactList.push(content.rspInfo.itUser);
					}

					if (content.people != undefined && content.people != null) {

						var list = [];
						for (var i = 0; i < content.people.length; i++) {
							content.people[i].date = this.utils.formatDate(new Date(content.people[i].deadline * 1000), "yyyy-MM-dd");
							var j = {};
							if (content.people[i].peopleUserId != 0) {
								j.id = content.people[i].peopleUserId;
							} else {
								content.people[i].peopleUserId = content.people[i].peopleName;
								j.id = content.people[i].peopleName;
							}
							j.user_name = content.people[i].peopleName;
							list.push(j);
							if (this.isEdit == 1) {
								var r = this.dutyList.find(e => e.value == content.people[i].duty)
								if (r == undefined) {
									this.createDuty(content.people[i].duty)
								}
							}
						}
						this.peopleList = list;
					}
					this.people = content.people;
					this.object = content;
				}
				this.files = data.files;
				//this.ifIT(content.userId);
				this.getSys();
				if (this.isEdit == 1) {
					this.changePeopleBefore();
					this.getBusiness(content.projectId);
				}
				this.object.reqSubject = this.processInfo.reqSubject
				console.log("getApplyInfo------content--->", content);
			},
			getDrafts() {
				var url = this.CONFIG.base_url_test + "/draft/content/" + this.draftsId
				var that = this;
				ajax.get({
					url: url,
					that: that,
					params: null,
					success: function(data) {
						console.log("-----getDrafts-----", data);
						if (data.req.object.itContactId > 0) {
							var list = [];
							var j = {};
							j.id = data.req.object.itContactId;
							j.user_name = data.req.object.itName;
							list.push(j);
							that.itContactList = list;
							that.changeItUser(list);
						}

						if (data.req.object.people != undefined && data.req.object.people != null) {
							var peopleList = [];
							for (var i = 0; i < data.req.object.people.length; i++) {
								if (data.req.object.people[i].peopleName != undefined && data.req.object.people[i].peopleName !=
									"" && data.req.object.people[i].peopleName != null) {

									var j = {};
									if (data.req.object.people[i].peopleUserId > 0) {
										j.id = data.req.object.people[i].peopleUserId;
									} else {
										data.req.object.people[i].peopleUserId = data.req.object.people[i].peopleName;
										j.id = data.req.object.people[i].peopleName;
									}
									//console.log("-----ee--",typeof(data.req.account.people[i].peopleUserId));
									j.user_name = data.req.object.people[i].peopleName;
									peopleList.push(j);
								}

								var content = data.req.object;
								var r = that.dutyList.find(e => e.value == content.people[i].duty)
								if (r == undefined) {
									that.createDuty(content.people[i].duty)
								}
							}
							that.peopleList = peopleList;
							//console.log("=====that.peopleList=====",that.peopleList);
						}

						that.people = data.req.object.people;
						that.files = data.req.files;
						that.object = data.req.object;
						that.object.reqSubject = data.req.puslicInfo.reqSubject;
						that.getRoles(that.$store.state.user.id);

						//console.log("-----草稿data------------->", data,that.peopleList);
					}
				})
			},

			getRoles(id) {
				//console.log("222222222222");
				var that = this;
				var url = this.CONFIG.url_know + '/tenantByUserId/' + id;
				ajax.get({
					that: that,
					url: url,
					success: function(data) {
						console.log("----data----", data);
						that.roleList = data;
						//console.log("--------",that.account.roleId);
						that.getProject();
					}
				})
			},
			getProject(data) {
				if (data != null && data != undefined) {
					console.log("========getProject======", data);
					this.object.tenantName = data.label;
				}

				if (this.object.roleId != null && this.object.roleId != "") {
					var r_id = this.object.roleId;

					this.roleList.some(item => {
						console.log("========item======", item.id, r_id);
						if (r_id == item.id) {
							this.projectList = item.projects;
							return true
						}
					})
					// var that = this;
					// var url = this.CONFIG.url_know + '/getProjects/' + r_id;
					// ajax.get({
					//   that: that,
					//   url: url,
					//   success: function(data) {
					//     if (data.length == 0) {
					//       that.object.projectId = 0;
					//     }
					//     that.projectList = data;
					//     console.log("=====that.projectList=======", that.projectList);
					//   }
					// })
				}
			},
			getBusiness(id) {
				if (id != null || id != undefined) {
					var that = this;
					var url = this.CONFIG.url_know + '/getTenant/' + id;
					ajax.get({
						that: that,
						url: url,
						success: function(data) {
							that.object.businessId = data.id;
							console.log("====name=====", that.object.businessId);
						}
					})
				}
			},
			getSys() {
				var that = this;
				var url = this.CONFIG.progress_url + '/system-map/for/account';
				ajax.get({
					that: that,
					url: url,
					success: function(data) {
						that.sysList = data;
						console.log("------that.sysList--------", that.sysList);
						if (that.object.sysId != undefined) {
							for (var i = 0; i < data.length; i++) {
								if (data[i].id === that.object.sysId) {
									that.sysModel = data[i];
									that.object.sysName = data[i].sysName;
								}
							}
						}
						//console.log("---sysList-------",that.rspInfo);
					}
				})
			},
			changeItUserBefore() {
				var list = [];
				var j = {};
				j.id = this.object.itContactId;
				list.push(j);
				this.changeItUser(list);
			},
			changeItUser(list) {
				//console.log("----changeItUser---------",this.itContactList);
				if (list[0].id != 0) {
					this.object.itContactId = list[0].id;
					this.object.itName = list[0].user_name;
					var that = this;
					var url = this.CONFIG.url_know + '/structsByUid/' + this.object.itContactId;
					ajax.get({
						that: that,
						url: url,
						success: function(data) {
							that.comDepList = data;
						}
					})
				} else {
					this.object.itContactId = list[0].id;
					this.object.itName = list[0].user_name;
				}
			},
			changeBranch(data) {
				//console.log("------changeBranch------",data);
				if (data != undefined && data != null) {
					this.object.itBranch = data.label;
				}
			},
			changePeopleBefore() {
				if (this.object.people != undefined && this.object.people != null) {
					for (var i = 0; i < this.object.people.length; i++) {
						if (this.object.people[i].peopleUserId > 0) {
							var list = [];
							var j = {};
							j.id = this.object.people[i].peopleUserId;
							j.user_name = this.object.people[i].peopleName;
							list.push(j);
							this.changePeople(list, i);
						}
					}
				}
			},
			changePeople(list, index) {
				//console.log("00000000");
				console.log("----changePeople---------", list);
				console.log("========", !this.ifedit);
				if (!this.ifedit) {
					//console.log("----changePeople---------",list,index,typeof(list[0].id));
					this.people[index].companyList = [];
					if (list[0] != undefined) {
						if ((list[0].id > 0) && (typeof(list[0].id) === "number")) {
							this.people[index].peopleUserId = list[0].id;
							this.people[index].peopleName = list[0].user_name;
							//this.people[index].fourA = list[0].fourA;
							//this.people[index].phone = list[0].phone;
							var that = this;
							var url = this.CONFIG.url_know + '/getCom-FourA/' + this.people[index].peopleUserId;
							ajax.get({
								that: that,
								url: url,
								success: function(data) {
									console.log("----data--------", data);
									that.people[index].companyList = data.structs;
									that.people[index].fourA = data.fourA;
									that.people[index].phone = data.phone;
								}
							})
						} else {
							this.people[index].fourA = "";
							this.people[index].phone = "";
							this.people[index].outterCompany = "";
							this.people[index].peopleUserId = 0;
							this.people[index].peopleName = list[0].user_name;
							//console.log("----peopleUserId---------",this.people);
						}
					};
				}
			},
			getCompanyBefore() {
				for (var i = 0; i < this.people.length; i++) {
					if ((this.people[i].peopleUserId > 0) && (typeof(this.people[i].peopleUserId) === "number")) {
						//console.log("=====peopleUserId=====",this.people[i].peopleUserId,i);
						this.getCompany(this.people[i].peopleUserId, i);
					}
				}
			},
			getCompany(id, index) {
				//console.log("----3333333--------",id);
				var that = this;
				var url = this.CONFIG.url_know + '/getCom-FourA/' + id;
				ajax.get({
					that: that,
					url: url,
					success: function(data) {
						//console.log("----companydata--------",data,that.people[index]);
						that.people[index].companyList = data.structs;
					}
				})
			},
			createDuty(val) {
				this.dutyList.push({
					value: val,
					label: val
				});
			},
			addRow() {
				this.people.push({
					isExpand: 0,
					date: "",
					isSever: false,
					isDb: false,
					isHadoop: false,
					isHftp: false,
					isPaas: false,
					isDacp: false,
					isElse: false,
					companyList: [],

					baseId: 0,
					commons: [{
						accountType: 0,
						deadline: 0,
						des: "",
						id: 0,
						json: "",
						peopleId: 0,
						status: 0,
						subAccount: ""
					}],
					dacps: [],
					dbs: [],
					deadline: 0,
					duty: "",
					elseAuthes: [],
					exAccount: "",
					fourA: "",
					hadoops: [],
					hftps: [],
					id: 0,
					igroup: "",
					outterCompany: "",
					outterCompanyId: 0,
					paas: [],
					peopleName: "",
					peopleType: 0,
					peopleUserId: 0,
					phone: "",
					severs: [],
					tenantName: ""
				});
				this.getNextYear(this.people.length - 1);
			},
			getNextYear(index) {
				var now = Date.now();
				var temp = new Date(now);
				var nextYear = temp.getFullYear() + 1;
				var month = temp.getMonth() + 1;
				var day = temp.getDate();
				var date = nextYear + "-" + month + "-" + day;
				this.people[index].date = date;
				this.dateFormat(index, date);
			},
			removeRow(index) {
				this.people.splice(index, 1);
			},
			expandRow(index) {
				if (this.people[index].isExpand < 0) {
					this.people[index].isExpand = 0;
				} else {
					this.people[index].isExpand = -1;
				}
			},
			copyRow(index) {
				var string = JSON.stringify(this.people[index]);
				var people = JSON.parse(string);

				this.people.push({
					isExpand: 0,
					date: people.date,
					isSever: people.isSever,
					isDb: people.isDb,
					isHadoop: people.isHadoop,
					isHftp: people.isHftp,
					isPaas: people.isPaas,
					isDacp: people.isDacp,
					isElse: people.isElse,
					companyList: [],

					baseId: 0,
					commons: [{
						accountType: 0,
						deadline: 0,
						des: "",
						id: 0,
						json: "",
						peopleId: 0,
						status: 0,
						subAccount: ""
					}],
					dacps: people.dacps,
					dbs: people.dbs,
					deadline: people.deadline,
					duty: "",
					elseAuthes: people.elseAuthes,
					exAccount: people.exAccount,
					fourA: "",
					hadoops: people.hadoops,
					hftps: people.hftps,
					id: 0,
					igroup: "",
					outterCompany: "",
					outterCompanyId: 0,
					paas: people.paas,
					peopleName: "",
					peopleType: 0,
					peopleUserId: 0,
					phone: "",
					severs: people.severs,
					tenantName: ""
				});
				console.log("==========", this.people[this.people.length - 1]);
			},
			addServer(index) {
				this.people[index].severs.push({
					accountAttr: "",
					deadline: 0,
					id: 0,
					ip: "",
					peopleId: 0,
					rxPath: "",
					sname: "",
					status: 0,
					subAccount: "",
					wpath: ""
				});
			},
			removeServer(index, ser_index) {
				this.people[index].severs.splice(ser_index, 1);
			},
			addDB(index) {
				this.people[index].dbs.push({
					accountAttr: "",
					auth: "",
					dbName: "",
					deadline: 0,
					id: 0,
					ip: "",
					peopleId: 0,
					sname: "",
					status: 0,
					subAccount: "",
					tableName: ""
				});
			},
			removeDB(index, db_index) {
				this.people[index].dbs.splice(db_index, 1);
			},
			addHadoop(index) {
				this.people[index].hadoops.push({
					hadoopAccountType: "",
					auth: "",
					cpu: 10,
					deadline: 0,
					hdfs: "100G",
					keytab: "",
					id: 0,
					mem: 40,
					peopleId: 0,
					status: 0,
					subAccount: ""
				});
			},
			removeHadoop(index, ha_index) {
				this.people[index].hadoops.splice(ha_index, 1);
			},
			dateFormat(index, event) {
				this.people[index].date = event;
				var date = new Date(this.people[index].date);
				this.people[index].deadline = (date.getTime() / 1000);
			},
			changeSever(index) {
				this.people[index].severs = [];
				if (this.people[index].isSever) {
					this.people[index].severs.push({
						accountAttr: "",
						deadline: 0,
						id: 0,
						ip: "",
						peopleId: 0,
						rxPath: "",
						sname: "",
						status: 0,
						subAccount: "",
						wpath: ""
					});
				}
			},
			changeDb(index) {
				this.people[index].dbs = [];
				if (this.people[index].isDb) {
					this.people[index].dbs.push({
						accountAttr: "",
						auth: "",
						dbName: "",
						deadline: 0,
						id: 0,
						ip: "",
						peopleId: 0,
						sname: "",
						status: 0,
						subAccount: "",
						tableName: ""
					});
				}
			},
			changeHadoop(index) {
				this.people[index].hadoops = [];
				if (this.people[index].isHadoop) {
					this.people[index].hadoops.push({
						cpu: 10,
						deadline: 0,
						hdfs: "100G",
						keytab: "",
						id: 0,
						mem: 40,
						peopleId: 0,
						status: 0,
						subAccount: ""
					});
				}
			},
			changeUap(index) {
				this.people[index].hftps = [];
				if (this.people[index].isHftp) {
					this.people[index].hftps.push({
						deadline: 0,
						id: 0,
						isCluster: false,
						isPerson: false,
						isPro: false,
						peopleId: 0,
						status: 0,
						subAccount: ""
					});
				}
			},
			changePaas(index) {
				this.people[index].paas = [];
				if (this.people[index].isPaas) {
					this.people[index].paas.push({
						deadline: 0,
						id: 0,
						paasType: "",
						peopleId: 0,
						status: 0,
						subAccount: ""
					});
				}
			},
			changeDacp(index) {
				this.people[index].dacps = [];
				if (this.people[index].isDacp) {
					this.people[index].dacps.push({
						dacpAccoutType: "",
						deadline: 0,
						id: 0,
						peopleId: 0,
						status: 0,
						subAccount: ""
					});
				}
			},
			changeElse(index) {
				this.people[index].elseAuthes = [];
				if (this.people[index].isElse) {
					this.people[index].elseAuthes.push({
						deadline: 0,
						des: "",
						id: 0,
						peopleId: 0,
						status: 0,
						subAccount: ""
					});
				}
			},
			checkIP(data){
			    console.log("====data====",data);
			    let ipRegex = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
			    if (ipRegex.test(data) === false) {
			        return false;
			    } else {
			        return true;
			    }
			},
			validate() {
				console.log("--------------", this.object.projectId, this.serviceType);
				var isSubmit = true;


				if (this.object.reqSubject == '') {
					this.$Message.error({
						content: '请填写工单标题!',
						duration: 3
					});
					isSubmit = false;
				} else if (this.object.sysId == null || this.object.sysId == 0) {
					this.$Message.error({
						content: '请选择所属系统!',
						duration: 3
					});
					isSubmit = false;
				} else if (this.object.roleId == null || this.object.roleId == 0) {
					this.$Message.error({
						content: '请选择所属租户!',
						duration: 3
					});
					isSubmit = false;
				} else if (this.object.projectId == null || this.object.projectId == 0) {
					this.$Message.error({
						content: '请选择所属项目!',
						duration: 3
					});
					isSubmit = false;
				} else if (this.object.reqDes === "" || this.object.reqDes === null) {
					this.$Message.error({
						content: '请填写需求描述!',
						duration: 3
					});
					isSubmit = false;
				} else if (this.people.length === 0) {
					this.$Message.error({
						content: '请至少新增一个使用人!',
						duration: 3
					});
					isSubmit = false;
				} else if (this.people.length > 0) {
					for (var i = 0; i < this.people.length; i++) {
						var number = i + 1
						if (this.utils.objectIsEmpty(this.people[i].peopleName)) {
							this.$Message.error({
								content: '请填写第' + number + '条账号申请的姓名!',
								duration: 3
							});
							isSubmit = false;
							break;
						}

						if (this.utils.objectIsEmpty(this.people[i].fourA)) {
							this.$Message.error({
								content: '请填写第' + number + '条账号申请的已有一级4A主账号!',
								duration: 3
							});
							isSubmit = false;
							break;
						}

						if (this.people[i].deadline === 0 || this.people[i].deadline === undefined || this.people[i].deadline ===
							null) {
							this.$Message.error({
								content: '请填写第' + number + '条账号申请的使用期限!',
								duration: 3
							});
							isSubmit = false;
							break;
						}

						if (!(this.people[i].isSever || this.people[i].isDb || this.people[i].isHadoop || this.people[i].isHftp ||
								this.people[i].isPaas || this.people[i].isDacp || this.people[i].isElse)) {
							this.$Message.error({
								content: '请第' + number + '条账号申请的至少选择一种账号类型!',
								duration: 3
							});
							isSubmit = false;
							break;
						}

						if (this.people[i].isSever) {
							if (this.people[i].severs.length === 0) {
								this.$Message.error({
									content: '请第' + number + '条账号申请的至少新增一个主机账号!',
									duration: 3
								});
								isSubmit = false;
								break;
							} else {
								for (var j = 0; j < this.people[i].severs.length; j++) {
									var number2 = j + 1
									if (this.utils.objectIsEmpty(this.people[i].severs[j].accountAttr)) {
										this.$Message.error({
											content: '请填写第' + number + '条账号申请中第' + number2 + '条主机账号的账号属性!',
											duration: 5
										});
										isSubmit = false;
										break;
									}
									// if (this.utils.objectIsEmpty(this.people[i].severs[j].sname)) {
									// 	this.$Message.error({
									// 		content: '请填写第' + number + '条账号申请中第' + number2 + '条主机账号的设备名称!',
									// 		duration: 5
									// 	});
									// 	isSubmit = false;
									// 	break;
									// }
									if (this.utils.objectIsEmpty(this.people[i].severs[j].ip)) {
										this.$Message.error({
											content: '请填写第' + number + '条账号申请中第' + number2 + '条主机账号的设备IP地址!',
											duration: 5
										});
										isSubmit = false;
										break;
									}
									// if (this.utils.objectIsEmpty(this.people[i].severs[j].rxPath)) {
									// 	this.$Message.error({
									// 		content: '请填写第' + number + '条账号申请中第' + number2 + '条主机账号的组读和执行权限目录!',
									// 		duration: 5
									// 	});
									// 	isSubmit = false;
									// 	break;
									// }
									if(!this.checkIP(this.people[i].severs[j].ip)){
										this.$Message.error({
											content: '第' + number + '条账号申请中第' + number2 + '条主机账号的设备IP地址格式不正确!',
											duration: 5
										});
										isSubmit = false;
										break;
									}
								}
							}
						}

						if (this.people[i].isDb) {
							if (this.people[i].dbs.length === 0) {
								this.$Message.error({
									content: '请第' + number + '条账号申请的至少新增一个数据库账号!',
									duration: 3
								});
								isSubmit = false;
								break;
							} else {
								for (var j = 0; j < this.people[i].dbs.length; j++) {
									var number2 = j + 1
									if (this.utils.objectIsEmpty(this.people[i].dbs[j].accountAttr)) {
										this.$Message.error({
											content: '请填写第' + number + '条账号申请中第' + number2 + '条数据库账号的账号属性!',
											duration: 5
										});
										isSubmit = false;
										break;
									}
									// if (this.utils.objectIsEmpty(this.people[i].dbs[j].sname)) {
									// 	this.$Message.error({
									// 		content: '请填写第' + number + '条账号申请中第' + number2 + '条数据库账号的设备名称!',
									// 		duration: 5
									// 	});
									// 	isSubmit = false;
									// 	break;
									// }
									if (this.utils.objectIsEmpty(this.people[i].dbs[j].ip)) {
										this.$Message.error({
											content: '请填写第' + number + '条账号申请中第' + number2 + '条数据库账号的设备IP地址!',
											duration: 5
										});
										isSubmit = false;
										break;
									}

									if(!this.checkIP(this.people[i].dbs[j].ip)){
										this.$Message.error({
											content: '第' + number + '条账号申请中第' + number2 + '条数据库账号的设备IP地址格式不正确!',
											duration: 5
										});
										isSubmit = false;
										break;
									}

									if (this.utils.objectIsEmpty(this.people[i].dbs[j].dbName)) {
										this.$Message.error({
											content: '请填写第' + number + '条账号申请中第' + number2 + '条数据库账号的库名!',
											duration: 5
										});
										isSubmit = false;
										break;
									}
									if (this.utils.objectIsEmpty(this.people[i].dbs[j].tableName)) {
										this.$Message.error({
											content: '请填写第' + number + '条账号申请中第' + number2 + '条数据库账号的表名!',
											duration: 5
										});
										isSubmit = false;
										break;
									}
									if (this.utils.objectIsEmpty(this.people[i].dbs[j].auth)) {
										this.$Message.error({
											content: '请填写第' + number + '条账号申请中第' + number2 + '条数据库账号的权限!',
											duration: 5
										});
										isSubmit = false;
										break;
									}
								}
							}
						}

						if (this.people[i].isHadoop) {
							if (this.people[i].hadoops.length === 0) {
								this.$Message.error({
									content: '请第' + number + '条账号申请的至少新增一个Hadoop账号!',
									duration: 3
								});
								isSubmit = false;
								break;
							} else {
								for (var j = 0; j < this.people[i].hadoops.length; j++) {
									var number2 = j + 1
									if (this.utils.objectIsEmpty(this.people[i].hadoops[j].keytab)) {
										this.$Message.error({
											content: '请填写第' + number + '条账号申请中第' + number2 + '条Hadoop账号的keytab描述!',
											duration: 5
										});
										isSubmit = false;
										break;
									}
									if (this.utils.objectIsEmpty(this.people[i].hadoops[j].hadoopAccountType)) {
										this.$Message.error({
											content: '请填写第' + number + '条账号申请中第' + number2 + '条Hadoop账号的Hadoop组件!',
											duration: 5
										});
										isSubmit = false;
										break;
									}
									if (this.utils.objectIsEmpty(this.people[i].hadoops[j].auth)) {
										this.$Message.error({
											content: '请填写第' + number + '条账号申请中第' + number2 + '条Hadoop账号的具体权限描述!',
											duration: 5
										});
										isSubmit = false;
										break;
									}
								}
							}
						}

						if (this.people[i].isHftp) {
							for (var j = 0; j < this.people[i].hftps.length; j++) {
								if (!(this.people[i].hftps[j].isCluster || this.people[i].hftps[j].isPerson || this.people[i].hftps[j].isPro)) {
									this.$Message.error({
										content: '请填写第' + number + '条账号申请中UAP账号的场景说明!',
										duration: 3
									});
									isSubmit = false;
									break;
								}
							}
						}

						if (this.people[i].isPaas) {
							for (var j = 0; j < this.people[i].paas.length; j++) {
								if (this.people[i].paas[j].paasType === "") {
									this.$Message.error({
										content: '请填写第' + number + '条账号申请中PaaS门户账号类型!',
										duration: 3
									});
									isSubmit = false;
									break;
								}
							}
						}

						if (this.people[i].isDacp) {
							for (var j = 0; j < this.people[i].dacps.length; j++) {
								if (this.people[i].dacps[j].dacpAccoutType === "") {
									this.$Message.error({
										content: '请填写第' + number + '条账号申请中DACP账号类型!',
										duration: 3
									});
									isSubmit = false;
									break;
								}
							}
						}

						if (this.people[i].isElse) {
							for (var j = 0; j < this.people[i].elseAuthes.length; j++) {
								if (this.people[i].elseAuthes[j].des === "") {
									this.$Message.error({
										content: '请填写第' + number + '条账号申请中其他权限内容的描述!',
										duration: 3
									});
									isSubmit = false;
									break;
								}
							}
						}

					}
				}
				if(isSubmit){
					if ((this.serviceType == 'accountNoBigdata') && (this.object.businessId != this.$store.state.user.id) && (
							this.files.length == 0)) {
						this.$Message.error({
							content: '请打印工单并上传附件!',
							duration: 5
						});
						isSubmit = false;
					}
				}
				return isSubmit
			},
			getInfo() {
				for (var i = 0; i < this.people.length; i++) {
					// if(this.serviceType === 'accountNoBigdata'){
					//     this.people[i].peopleType = 1;
					// }

					for (var j = 0; j < this.people[i].severs.length; j++) {
						this.people[i].severs[j].deadline = this.people[i].deadline;
					};
					for (var j = 0; j < this.people[i].dbs.length; j++) {
						this.people[i].dbs[j].deadline = this.people[i].deadline;
					};
					if (this.people[i].hadoops.length > 0) {
						this.people[i].hadoops[0].deadline = this.people[i].deadline;
					}
					if (this.people[i].hftps.length > 0) {
						this.people[i].hftps[0].deadline = this.people[i].deadline;
					}
					if (this.people[i].paas.length > 0) {
						this.people[i].paas[0].deadline = this.people[i].deadline;
					}
					if (this.people[i].dacps.length > 0) {
						this.people[i].dacps[0].deadline = this.people[i].deadline;
					}
					if (this.people[i].elseAuthes.length > 0) {
						this.people[i].elseAuthes[0].deadline = this.people[i].deadline;
					}
					if (typeof(this.people[i].peopleUserId) != 'number') {
						this.people[i].peopleUserId = 0;
					}
				};
				this.object.userId = this.$store.state.user.id;
				this.object.people = this.people;
				this.object.files = this.files;
				this.content.object = this.object;
				var publicInfo = this.utils.setPublicInfoInfo(this.object.reqSubject, 0, 0, this.object.reqDes)
				//this.content.files = this.$refs.fileUpload.applyinfo.files;
				this.content.puslicInfo = publicInfo
				this.content.files = this.files;
				this.content.demandAssign = this.object.itContactId;
				//console.log("content----------->",this.content);
				return this.content;
			},
			// 获取处理时需要提交的参数
			getHandleParams(handleInfo) {
				handleInfo.reqSubject = this.object.reqSubject
				handleInfo.startTime = 0
				handleInfo.hopeTime = 0
				handleInfo.reqDes = this.object.reqDes
				handleInfo.isEdit = this.isEdit;

				handleInfo.roleId = this.object.roleId;
				handleInfo.sysId = this.object.sysId;
				handleInfo.projectId = this.object.projectId;

				console.log("aaaa-------->", this.ifedit, this.isEdit == 1)
				handleInfo.isChangeContent = 0;
				if (!this.ifedit) {
					handleInfo.isChangeContent = 1;
				}
				if (this.isEdit == 1) {
					handleInfo.content = this.getInfo()
				}
				// 账号相关
				// if (((that.serviceType === 'sonAccountAllo' && that.taskDefKey === '_3') ||
				//     (that.serviceType === 'accountNoBigdata' && that.taskDefKey === '_08son') ||
				//     (that.serviceType === 'accountBigdata' && that.taskDefKey === '_06son'))
				//     && (that.handleInfo.operation === 'yes')) {
				//   console.log("----operation------", that.handleInfo.operation);
				//   that.submintSubAccount();
				//   that.handleInfo.content.object = that.myObject;
				//   that.handleInfo.isEditAccount = that.isEdit;
				// }
				//设置账号申请相关
				// submintSubAccount() {
				//   this.myObject.severs = this.$refs.sonAccount.severs;
				//   this.myObject.dbs = this.$refs.sonAccount.dbs;
				//   this.myObject.hadoops = this.$refs.sonAccount.hadoops;
				//   this.myObject.hftps = this.$refs.sonAccount.hftps;
				//   this.myObject.paas = this.$refs.sonAccount.paas;
				//   this.myObject.dacps = this.$refs.sonAccount.dacps;
				//   this.myObject.elseAuthes = this.$refs.sonAccount.elseAuthes;
				//   console.log("--------this.myObject", this.myObject);
				// },
			},
			//处理页面获取下一步处理人需要的参数
			getHandleUserParams(opOptions) {
				var param = {}
				param.vari = opOptions
				param.roleId = this.object.roleId;
				param.sysId = this.object.sysId;
				param.projectId = this.object.projectId;
				return param
			},

		},

		computed: {
			newValue: {
				get: function() {
					return this.value;
				},
				set: function(value) {
					this.$emit('input', value);
				}
			},
		},
		props: {
			isEdit: {},
			value: {
				dafault: false
			},
			params: {},
			serviceType: {},
			ifedit: {
				type: Boolean,
				default: false,
			},
			reqId: {
				default: null
			},
			draftsId: {
				default: null
			},
			filesList: {},
			processInfo: {},
		},
		watch: {
			// getEditData(this.ifedit){

			// },
			ifedit(Val) {
				this.getRoles(this.object.userId);
				this.getSys();
				this.changeItUserBefore();
				this.getCompanyBefore();
				//this.changePeopleBefore();
			},
			newValue(val) {
				if (val) {
					console.log("=====get打印111=====", this.reqId);
					if (this.reqId == "" || this.reqId == null || !this.ifedit) {
						this.printBase();
					} else {
						this.getPrintObject();
					}
					this.print()
				}
			}
		}
	}
</script>
